package cn.hh.hrm.client;


import cn.hh.hrm.doc.CourseDoc;
import cn.hh.hrm.query.CourseDocQuery;
import cn.hh.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseDocFallBackFactory implements FallbackFactory<ICourseDocClient> {
    @Override
    public ICourseDocClient create(Throwable throwable) {
        return new ICourseDocClient() {
            @Override
            public AjaxResult onLineCourse(CourseDoc courseDoc) {
                return AjaxResult.me().setSuccess(false).setMessage("课程发布失败");
            }

            @Override
            public AjaxResult offLineCourse(CourseDoc doc) {
                return AjaxResult.me().setSuccess(false).setMessage("课程下线失败");
            }

            @Override
            public AjaxResult queryCourses(CourseDocQuery query) {
                return AjaxResult.me().setSuccess(false).setMessage("课程查询失败");
            }
        };
    }
}
